#ifndef __MARS_GRAPHICS_CONSTANT_MGR_H__
#define __MARS_GRAPHICS_CONSTANT_MGR_H__

#include "MarsObject.h"
#include "MarsVRamBuffer.h"

namespace Graphics
{

class ConstantMgr : public Core::Object
{
public:
									~ConstantMgr();

	bool							Initialize();
	void							Shutdown();

	static ConstantMgr&				Instance();
	static void						Destroy();

	VRamBuffer*						GetConstantBuffer( Core::uint32 iSize );
	
protected:
	VRamBuffer*						AllocateConstantBuffer( Core::uint32 iSize );

private:
									ConstantMgr();
									ConstantMgr( const ConstantMgr& );
	ConstantMgr&					operator = ( const ConstantMgr& );

	static ConstantMgr*				ms_pConstantMgr;

	typedef std::map< Core::uint32, std::vector< VRamBuffer* > > ConstantsMap;
	typedef ConstantsMap::iterator ConstantsMapItr;
	typedef ConstantsMap::const_iterator ConstantsMapConstItr;

	ConstantsMap					m_mapConstants;
};

inline ConstantMgr& ConstantMgr::Instance()
{
	if ( !ms_pConstantMgr )
	{
		ms_pConstantMgr = new ConstantMgr();
	}

	return ( *ms_pConstantMgr );
}

} // end of namespace Graphics

#endif // end of #ifndef __MARS_GRAPHICS_CONSTANT_MGR_H__